package com.hz.web.util;

import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class Constant {

	//excle导入判断
	public static final String EXCLE_COMPANY_NAME="企业名称";
	public static final String EXCLE_COMPANY_DATE="承诺时间";
	public static final String EXCLE_PERSONAL_NAME="自然人姓名";
	public static final String EXCLE_ENTERPRISE_NAME="部门";

	
	public static final int MENU_PARENT_GEN = 0;//从根目录查询菜单
	public static final int MENU_PARENT_FIRST = 1;//从第一级目录查询菜单
	
	public static final String MENU_ROLE_URL_TYPE_YES = "yesRole";//已分配权限  如要修改，不要忘记 role.jsp   
	public static final String MENU_ROLE_URL_TYPE_NO = "noRole";//未分配权限  和MenuMappwe.xml
	/**
	 * ckType
	 * ck/toHtmlManage?ckType=1
	 * 直接涉及到富文本编辑器的 （不显示数据表格的）
	 * 1 企业招聘
	 * 2人才招聘
	 * 3联系方法
	 * 4产品介绍
	 */

	public static final String TYPE5 = "topFlash";
	public static final String TYPE6 = "middleFlash";
	public static final String TYPE7 = "bottomFlash";
	public static final String TYPE8 = "新闻热点";
	public static final String TYPE9 = "通知公告";
	public static final String TYPE10 = "技术动态";
	public static final String TYPE11 = "企业要闻";
	public static final String TYPE12 = "政策法规";
	public static final String TYPE13 = "展会信息";
	
	public static final String TYPE21 = "安防产品";
	public static final String TYPE22 = "行业动态";
	public static final String TYPE23 = "协会章程";

	public static final String TYPE26 = "资质评定";
	public static final String TYPE27 = "信用评价";

	public static final String TYPE30 = "人员认定";
	public static final String TYPE31 = "标准规范";

	public static final String TYPE40 = "帮助中心";

	public static final String TYPE50 = "协会介绍";


	


	
	public static final String TYPE100 = "行政双公示";
	//富文本CK
	public static final String CKSTATS1="1";//显示
	public static final String CKSTATS2="2";//不显示  删除

	public static final class MSG {
		
		public static final String IMG_TYPE_ERROR = "格式不正确（必须为.jpg/.gif/.bmp/.jpeg/.png/.docx/.xlsx/.xls文件）";
		public static final String IMG_SIZE_ERROR = "大小不能超过2M";
		public static final String ICON_SIZE_ERROR = "大小不能超过50KB";
		public static final String UNKNOW_ERROR = "未知错误，请联系管理员";
		public static final String FILE_SIZE = "文件大小不可超过";
		public static final String IMG_WH = "长宽必须为";
		public static final String FILE_TYPE = "文件格式不符，请确认后上传";
		public static final String SAVE_OK = "{\"success\":\"true\",\"title\":\"成功\",\"content\":\"保存成功\"}";
		public static final String DEL_OK ="{\"success\":\"true\",\"title\":\"成功\",\"content\":\"删除成功\"}";
		public static final String UPDATE_OK ="{\"success\":\"true\",\"title\":\"成功\",\"content\":\"修改成功\"}";
		public static final String SAVE_ERR = "{\"success\":\"false\",\"title\":\"失败\",\"content\":\"保存失败\"}";
		public static final String DEL_ERR = "{\"success\":\"false\",\"title\":\"失败\",\"content\":\"删除失败\"}";
		public static final String UPDATE_ERR = "{\"success\":\"false\",\"title\":\"失败\",\"content\":\"修改失败\"}";
		
		
		public static final Map<String,Object> ERR_COMMON(String msg){
			Map<String,Object> map = new HashMap<String, Object>();
			map.put("title","失败");
			map.put("content",msg);
			map.put("success","error");
			return map;
		}
		
		public static final Map<String,Object> OK_COMMON(String msg){
			Map<String,Object> map = new HashMap<String, Object>();
			map.put("title","成功");
			map.put("content",msg);
			map.put("success","info");
			return map;
		}
		
		public static final Map<String,Object> SAVE_OK(){
			Map<String,Object> map = new HashMap<String, Object>();
			map.put("title","成功");
			map.put("content","保存成功");
			map.put("success","info");
			return map;
		}
		
		public static final Map<String,Object> UPD_OK(){
			Map<String,Object> map = new HashMap<String, Object>();
			map.put("title","成功");
			map.put("content","修改成功");
			map.put("success","info");
			return map;
		}
		
		public static final Map<String,Object> DEL_OK(){
			Map<String,Object> map = new HashMap<String, Object>();
			map.put("title","成功");
			map.put("content","删除成功");
			map.put("success","info");
			return map;
		}
		
		public static final Map<String,Object> SAVE_ERROR(){
			Map<String,Object> map = new HashMap<String, Object>();
			map.put("title","失败");
			map.put("content","保存失败");
			map.put("success","error");
			return map;
		}
		
		public static final Map<String,Object> UPD_ERROR(){
			Map<String,Object> map = new HashMap<String, Object>();
			map.put("title","失败");
			map.put("content","修改失败");
			map.put("success","error");
			return map;
		}
		
		public static final Map<String,Object> DEL_ERROR(){
			Map<String,Object> map = new HashMap<String, Object>();
			map.put("title","失败");
			map.put("content","删除失败");
			map.put("success","error");
			return map;
		}
		
		public static String getCKEditorMsg(String CKEditorFuncNum,
				String imgName, String errorMsg) {
			return "<script type=\"text/javascript\">window.parent.CKEDITOR.tools.callFunction("
					+ CKEditorFuncNum
					+ ", '"
					+ imgName
					+ "','"
					+ errorMsg
					+ "');</script>";
		}

	}

	public static final class PATH {
		/*public static final String CK_IMAGE_PATH = "them/ckeditor/fileupload/image";*/
		public static final String CK_IMAGE_PATH ="down";
		//ck上传路径
		/*public static final String CK_IMAGE_PATH1 = File.separator+"them"+File.separator+"ckeditor"+File.separator+"fileupload"+File.separator+"image";*/
		//富文本编辑器上传路径
		//public static final String CK_IMAGE_PATH1 = File.separator+"images"+File.separator+"ckimg";
		public static final String CK_IMAGE_PATH1 = File.separator+"down";
		//public static final String CK_FLASH_PATH = "them/ckeditor/fileupload/flash";		
		public static final String GETPATH(String savePath){
			String[] filePaths = savePath.split(",");
    		String filePath = "";
    		for(String str:filePaths){
    			filePath+=str+File.separator;
    		}
    		filePath=filePath.substring(0,filePath.length()-1);
    		return filePath;
		}
		public static void main(String[]args){
			System.out.println(GETPATH("them,images,banner"));
		}
	}

	public static final class FILE_TYPE {
		public static List<String> imgTypes() {
			List<String> fileTypes = new ArrayList<String>();
			fileTypes.add("jpg");
			fileTypes.add("jpeg");
			fileTypes.add("bmp");
			fileTypes.add("gif");
			fileTypes.add("png");
			fileTypes.add("docx");
			fileTypes.add("doc");
			fileTypes.add("xlsx");
			fileTypes.add("xls");
			fileTypes.add("pdf");
			return fileTypes;
		}
	}
	
}
